<?php
	/**
	 * 获取登陆用户信息
	 */
    class UserInfo extends APIBase {
		
		public $tag = "UserInfo";
		
        public function before() {
    		return true;
		}
		
		public function logic() {
			$user = $this->data_redis->hGetAll("hu:{$this->uid}");
			$total_board = isset($user['total_board']) ? $user['total_board'] : 0;
			$total_win = isset($user['total_win']) ? $user['total_win'] : 0;
			$total_lose = $total_board - $total_win;
			$user_info = array(
					'uid' => (int) $this->uid,
					'user' =>$user['user'],
					'name' => $user['name'],
					'sex' => (int) $user['sex'],
					'money' => (int) $user['money'],
					'bank' => (int) $user['bank'],
					//'rmb' => (int) $user['rmb'],
					'coin' => (int) $user['coin'],
					'history' => array((int) $total_win, (int) $total_lose),
					'exp' => (int) (isset($user['exp']) ? $user['exp'] : 0),
					'skey' => $user['skey'],
					'avater_url' => $user['avater_url'],
					'gift_num1' => (int)$user['gift_num1'],
					'gift_num2' => (int)$user['gift_num2'],
					'gift_num3' => (int)$user['gift_num3'],
					'gift_num4' => (int)$user['gift_num4'],
					'charisma' => (int)$user['charisma'],
					'changeCardtoolNum' => (int)$user['changeCardtoolNum'],
					'betsDoubletoolNum' => (int)$user['betsDoubletoolNum'],
					'banComparetoolNum' => (int)$user['banComparetoolNum']
			);
			
			$this->returnData($user_info);
		}
		
       	public function after() {
    		$this->deinitDataRedis();
		}
    }
?>
